const baseUrl = import.meta.env.VITE_SERVER_URL

const joinBaseUrl = function (url:string) {
  return baseUrl + url
}

const api = {
    auth: {
        login: joinBaseUrl('/auth/login'),
        register: joinBaseUrl('/auth/register'),
        refresh: joinBaseUrl('/auth/refresh'),
        guest: joinBaseUrl('/auth/guest'),
        getCaptcha: joinBaseUrl('/auth/getCaptcha'),
        getUserInfo: joinBaseUrl('/auth/getUserInfo'),
        getPersonalInfo: joinBaseUrl('/auth/getPersonalInfo'),
        editUserInfo: joinBaseUrl('/auth/editUserInfo'),
    },
    server:{
        getServerList: joinBaseUrl('/servers/getServerList'),
        getChannelList: joinBaseUrl('/servers/getChannelList'),
        createServer:  joinBaseUrl('/servers/createServer'),
        joinServer:  joinBaseUrl('/servers/joinServer'),
        changeActSC: joinBaseUrl('/servers/changeActSC'),
        getInviteCode:  joinBaseUrl('/servers/getInviteCode'),
        changeServerName:  joinBaseUrl('/servers/changeServerName'),
        createChannel: joinBaseUrl('/servers/createChannel'),
        getUserServerInfo: joinBaseUrl('/servers/getUserServerInfo'),
        exitServer: joinBaseUrl('/servers/exitServer'),
        getChannelInfo: joinBaseUrl('/servers/getChannelInfo'),
        editChannelInfo: joinBaseUrl('/servers/editChannelInfo'),
        deleteChannel:joinBaseUrl('/servers/deleteChannel'),
        getChannelMembers: joinBaseUrl('/servers/getChannelMembers'),
        editMemberPermission: joinBaseUrl('/servers/editMemberPermission'),
    },
    message:{
        getChannelMessageList: joinBaseUrl('/messages/getChannelMessageList'),
        sendChannelMessage: joinBaseUrl('/messages/sendChannelMessage'),
        deleteMessage: joinBaseUrl('/messages/deleteMessage'),
        getPrivateChatId: joinBaseUrl('/messages/getPrivateChatId'),
        getPrivateMessageList: joinBaseUrl('/messages/getPrivateMessageList'),
    },
    file:{
        init_upload: joinBaseUrl('/files/init_upload'),
        upload_chunk: joinBaseUrl('/files/upload_chunk'),
        complete_upload: joinBaseUrl('/files/complete_upload'),
        deleteFile: joinBaseUrl('/files/deleteFile'),
        getUserFileList: joinBaseUrl('/files/getUserFileList'),
    },
    friend:{
        getFriendGroup: joinBaseUrl('/friends/getFriendGroup'),
        addFriendGroup: joinBaseUrl('/friends/addFriendGroup'),
        addFriend: joinBaseUrl('/friends/addFriend'),
        deleteFriend: joinBaseUrl('/friends/deleteFriend'),
        changeFriendStatus: joinBaseUrl('/friends/changeFriendStatus'),
        moveToGroup: joinBaseUrl('/friends/moveToGroup'),
    },
    // 网易云音乐api
    music:{
        getMusicList: 'https://v3.alapi.cn/api/music/playlist',
        getMusicDetail: 'https://v3.alapi.cn/api/music/detail',
        searchMusic: 'https://v3.alapi.cn/api/music/search',
        getMusicUrl: 'https://v3.alapi.cn/api/music/url',
        getMusicLyric: 'https://v3.alapi.cn/api/music/lyric',
        getPlayLists: joinBaseUrl('/musics/getPlayLists'),
        addPlayList: joinBaseUrl('/musics/addPlayList'),
        editPlayList: joinBaseUrl('/musics/editPlayList'),
    },
}

export default api

export {baseUrl}